<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\User;
use App\Article; 
use App\Comment;
use App\Category;
use App\Notification;

class NotificationController extends Controller
{
    //
    public function index(Request $request){
        $no_user_id = $request->user()->no_id;     
        $notifications = Notification::where('to_user_id', 'like', '%'.$no_user_id.'%')->orderBy('created_at', 'desc')->get();
        // DB::select('SELECT SUBSTRING(createDate FROM 1 FOR 8)')
        // $articles->body = substr($articles->body, 0, 5);
        return view('notification/index',['notifications'=> $notifications]);
    }
}